package recursion;
//斐波那契数列:一对兔子,每3个月生一对兔子,小兔子3个月也能生一对兔子,假设兔子不死,问20个月有多少兔子
//1 1 2 3 5 8 13
public class RecursionDemo2 {
    public static void main(String[] args) {
      int month=20                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ;
        int rabbit = getRabbit(month);
        System.out.println(rabbit);

    }
    public static int getRabbit(int month){
        int rabbitNum=2;
        if (month==1||month==2){
            return rabbitNum;
        }else {
            return getRabbit(month-1)+getRabbit(month-2);
        }
    }
}
